Class CertUtil

java.lang.Object
org.dogtagpki.util.cert.CertUtil

public class CertUtil extends Object
  • Field Details

  • Constructor Details

    • CertUtil

      public CertUtil()
  • Method Details

    • unwrapCSR

      public static String unwrapCSR(String request, boolean checkHeader) throws EBaseException
      Convert PEM request into Base64.
      Parameters:
      request - PEM request
      Returns:
      Base64-encoded request
      Throws:
      EBaseException
    • parseCSR

      public static byte[] parseCSR(String csr)
    • decodePKCS10

      public static org.mozilla.jss.netscape.security.pkcs.PKCS10 decodePKCS10(String request) throws EBaseException
      Decode PKCS #10 certificate request from Base64.
      Parameters:
      request - Base64-encoded certificate request
      Returns:
      PKCS10 object
      Throws:
      EBaseException
    • toPEM

      public static String toPEM(org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10) throws Exception
      Throws:
      Exception
    • toPEM

      public static String toPEM(X509Certificate cert) throws Exception
      Throws:
      Exception
    • fingerPrintFormat

      public static String fingerPrintFormat(String content)
    • deleteCert

      public static void deleteCert(String tokenname, org.mozilla.jss.crypto.X509Certificate cert) throws Exception
      Throws:
      Exception
    • createRequestExtensions

      public static org.mozilla.jss.netscape.security.x509.CertificateExtensions createRequestExtensions(org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10) throws Exception
      Throws:
      Exception
    • getSANExtension

      public static org.mozilla.jss.netscape.security.x509.SubjectAlternativeNameExtension getSANExtension(org.mozilla.jss.netscape.security.x509.Extensions extensions) throws Exception
      Get SAN extension from a collection of extensions.
      Throws:
      Exception
    • getSANExtension

      public static org.mozilla.jss.netscape.security.x509.SubjectAlternativeNameExtension getSANExtension(org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10) throws Exception
      Get SAN extension from PKCS #10 request.
      Throws:
      Exception
    • getDNSNames

      public static Set<String> getDNSNames(org.mozilla.jss.netscape.security.x509.SubjectAlternativeNameExtension sanExtension) throws Exception
      Get DNS names from SAN extension.
      Throws:
      Exception
    • getCommonName

      public static String getCommonName(org.mozilla.jss.netscape.security.x509.X500Name name) throws Exception
      Throws:
      Exception
    • getDNSNames

      public static Set<String> getDNSNames(org.mozilla.jss.netscape.security.pkcs.PKCS10 pkcs10) throws Exception
      Get DNS names from PKCS #10 request.
      Throws:
      Exception
    • toCertificateUsage

      public static org.mozilla.jss.CertificateUsage toCertificateUsage(String certUsage) throws Exception
      Convert cert usage string into CertificateUsage object.
      Throws:
      Exception
    • getCertificateUsages

      public static Set<org.mozilla.jss.CertificateUsage> getCertificateUsages(String nickname) throws Exception
      Get certificate usages.
      Throws:
      Exception
    • verifyCertificateUsage

      public static void verifyCertificateUsage(String nickname, String certUsage) throws Exception
      Verify certificate usage.
      Throws:
      Exception
    • verifyCertValidity

      public static void verifyCertValidity(String nickname) throws Exception
      Verify that the cert is currently valid (notBefore <= now <= notAfter).
      Throws:
      Exception